package benny.ApkposStore.Adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import benny.ApkposStore.R;
import benny.ApkposStore.model.Dish_class;

public class dishtype1Adapter extends BaseAdapter {

	private Context context;
	private List<Dish_class> list;
	private LayoutInflater mInflater;
	//private TextPaint tp = null;
	public dishtype1Adapter(Context context, List<Dish_class> list) {
		this.context = context;
		this.list = list;
		mInflater = LayoutInflater.from(this.context);
	}

	public int getCount() {
		// TODO Auto-generated method stub
		if (list != null){
		return list.size();	
		}			
		else
			return 0;
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		if (list != null)
			return list.get(position);
		else
			return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@SuppressWarnings("unused")
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Dishtypeholder1 dishtypeholder1 = null;
		if (dishtypeholder1 == null) {

			dishtypeholder1 = new Dishtypeholder1();
			convertView = mInflater.inflate(R.layout.dishtypebtn1, null);
			dishtypeholder1.dishtype_btn1 = (TextView) convertView
					.findViewById(R.id.dishtype_btn1);			
			convertView.setTag(dishtypeholder1);
			
		} else {
			dishtypeholder1 = (Dishtypeholder1) convertView.getTag();
		}
		/*
		 * ///绑定点击事件 holder.roomtitle.setOnClickListener((OnClickListener)
		 * list.get(position).get("listen")); 
		 * if(Boolean.parseBoolean(list.get(position).get("bl").toString()))
		 * holder.roomtitle.setEnabled(true); else
		 * holder.roomtitle.setEnabled(false);
		 */
		
//   	中文加粗
//		tp = holder.roomtitle.getPaint();
//		tp.setFakeBoldText(true);
		
			dishtypeholder1.dishtype_btn1
			.setText(list.get(position).getName());		
			dishtypeholder1.DclaVar=
			list.get(position).getId();	
		return convertView;
	}

	public final class Dishtypeholder1 {
		public TextView dishtype_btn1;
		public float  DclaVar;
	}
}